/*
 * @Author: guandeshen 295570679@qq.com
 * @Date: 2024-05-11 21:09:19
 * @LastEditors: guandeshen 295570679@qq.com
 * @LastEditTime: 2024-09-02 14:50:00
 * @FilePath: /task-admin/src/views/system/menu/config/content.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import MenuAPI from "@/api/menu";
import type { MenuQuery } from "@/api/menu/model";
import type { IContentConfig } from "@/components/PageContent/index.vue";
import i18n from "@/lang/index";

const contentConfig: IContentConfig<MenuQuery> = {
  // tagList: [],
  searchPlaceholder: i18n.global.t("common.searchPlaceholder"),
  hasDashData: false,
  pageName: i18n.global.t("route.menu"),
  tableName: i18n.global.t("route.menu"),
  table: {
    highlightCurrentRow: true,
  },
  indexAction: function (params) {
    return MenuAPI.getPage(params);
  },
  deleteAction: MenuAPI.deleteByIds,
  pk: "id",
  toolbar: [
    "refresh",
    "add",
    "delete",
    // "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: i18n.global.t("common.import"),
    //   auth: "import",
    // },
  ],
  cols: [
    // { type: "selection", width: 50, align: "center" },
    {
      label: i18n.global.t("common.menuName"),
      align: "left",
      prop: "title",
      tooltip: true,
      minWidth: 140,
    },
    {
      label: i18n.global.t("common.routeName"),
      align: "left",
      prop: "name",
      tooltip: true,
      minWidth: 140,
    },
    {
      label: i18n.global.t("common.routePath"),
      align: "left",
      prop: "routePath",
      tooltip: true,
      minWidth: 140,
    },
    {
      label: i18n.global.t("common.menuType"),
      align: "center",
      prop: "ismenu",
      slotName: "ismenu",
      templet: "custom",
      width: 140,
    },
    {
      label: i18n.global.t("common.sort"),
      align: "left",
      prop: "weigh",
      tooltip: true,
      minWidth: 100,
    },
    {
      label: i18n.global.t("common.status"),
      align: "center",
      prop: "status",
      slotName: "status",
      templet: "custom",
      width: 140,
    },
    {
      label: i18n.global.t("common.operation"),
      fixed: "right",
      align: "center",
      width: 300,
      templet: "tool",
      operat: ["edit", "delete"], //"edit",
    },
  ],
};

export default contentConfig;
